/**
 * Created with IntelliJ IDEA.
 * User: wenxiwen
 * Date: 2022/4/5
 * Time: 19:31
 * Description: No Description
 */
class Animal {
    public String name;
    public int age;

    public void set() {
        System.out.println(this.name+"正在吃饭");
    }
}

 class Cat extends Animal{
    public String hair;

    public void set() {
        System.out.println(this.name+"正在睡觉");
    }
}
public class TestDemo {
    public static void main(String[] args) {
        Animal animal = new Cat();//向上转型  小引用指向大对象
        animal.set();
    }
}